/* eslint-disable */
/**报表后置方法
 */
const reportAfterFuns = {
  //入库明细
  inOrderItem (rowData){
    let in_mode = rowData.bus_type_in.toUpperCase()
    let routeName = null
    switch(in_mode) {
      case 'IN_MANUAL': //手动入库
        routeName = 'inorderManual'
        break;
      case 'IN_ASN': //采购入库
        routeName = 'inorderSP'
        break;
      case 'IN_PACKAGE': //跟台包
        routeName = 'inorderPackage'
        break;
      case 'IN_INIT': //期初入库
        routeName = 'inorderInit'
        break;

    }
    global.utils.openMenu(routeName, {id: rowData.id_in})
  },

  //调价明细-张伟
  priceAdjustmentItem(rowData){
    let type,typeKey
    let titleAppend = `调价单(${rowData.adjust_key})-调价金额明细`
    let queryWrapper = global.$newWrapper()
    type ='report'
    typeKey='price_adjust_item_report'
    queryWrapper.eq('adjust_id', rowData.adjust_id)
    global.utilPrint.openDialog(type,typeKey,queryWrapper, titleAppend)
  },

  //出库明细
  outOrderItem (rowData){
    let bus_type = rowData.from_type.toUpperCase()
    let routeName = null
    switch(bus_type) {
      case '配送出库': //配送出库
        routeName = 'dist'
        break;
      case '科室消耗出库': //科室消耗出库
        routeName = 'deptuse'
        break;
      case '病人消耗出库': //病人消耗出库
        routeName = 'oprtuse'
        break;
      case '供应商退货出库': //供应商退货出库
        routeName = 'deptreturn'
        break;
      case '调拨出库': //调拨出库
        routeName = 'transfer'
        break;
      default:
    }
    global.utils.openMenu(routeName, {id: rowData.ref_id})
  },
  //库存数量差异-按耗材
  stockDiffMatr (rowData, field){
    let type,typeKey,dialogMoreTitle
    let titleAppend = `-耗材(${rowData.name})-品规(${rowData.spec})-耗材id(${rowData.id})`
    let queryWrapper = global.$newWrapper()
    console.log('field',field)
    console.log('rowData',rowData)
    type ='report'
    typeKey='work_order_dtl_all'
    queryWrapper.eq('matr_id', rowData.id)
    switch(field) {
      case 'qtystock': //库存查看
        typeKey='stock'
        dialogMoreTitle = '库存'
        break;
      case 'qtyin': //入库查看
        queryWrapper.in('bus_type', ['IN_MANUAL','IN_ASN','IN_PACKAGE','IN_INIT','IN_DEPT_RETURN','IN_USE_RED','IN_OPRT_RED'])
        dialogMoreTitle = '入库'
        break;
      case 'qtyout': //出库查看
        queryWrapper.in('bus_type', ['OUT_USE','OUT_DIST','OUT_SP','OPRT_USE'])
        dialogMoreTitle = `出库`
        break;
      case 'qtyuse': //病人消耗查看
        queryWrapper.in('bus_type', ['IN_OPRT_RED','OPRT_USE'])
        dialogMoreTitle = '病人消耗及冲红'
        break;
      case 'qtydist': //配送查看
        queryWrapper.eq('bus_type', 'OUT_DIST')
        dialogMoreTitle = '配送'
        break;
      case 'qtyusedept': //科室消耗查看
        queryWrapper.in('bus_type', ['OUT_USE','IN_USE_RED'])
        dialogMoreTitle = '科室消耗及冲红'
        break;
      case 'qtybill': //记账查看
        typeKey='finance_bill_item'
        dialogMoreTitle = '记账'
        break;
      case 'diffstock': //差异维护
        type ='dataview'
        typeKey='wm_stock_diff'
        dialogMoreTitle = '库存差异维护'
        break;
    }
    global.utilPrint.openDialog(type,typeKey,queryWrapper, dialogMoreTitle+titleAppend)
  }


}

export default reportAfterFuns
